module.exports = {
  publicPath: process.env.NODE_ENV === "production" ? "./" : "/api",
  outputDir: "dist", //放整个打包的文件夹  // 是否在保存时使用‘eslint-loader’进行检查 // 有效值: true | false | 'error' // 当设置为‘error’时，检查出的错误会触发编译失败
  assetsDir: "assets", //放静态资源的地方(js[表情]s/img/font/...)
  lintOnSave: true, // 使用带有浏览器内编译器的完整构建版本 // https://vuejs.org/v2/guide/installation.html#Runtime-Compiler-vs-Runtime-only
  runtimeCompiler: false, // babel-loader默认会跳过`node_modules`依赖. // 通过这个选项可以显示转译一个依赖
  transpileDependencies: [
    /* string or regex */
  ], // 是否为生产环境构建生成sourceMap?

  productionSourceMap: false, // 调整内部的webpack配置. // see https://github.com/vuejs/vue-cli/blob/dev/docs/webpack.md
  chainWebpack: () => {},
  configureWebpack: () => {}, // CSS 相关选项
  css: {
    // 将组件内部的css提取到一个单独的css文件（只用在生产环境）
    // 也可以是传递给 extract-text-webpack-plugin 的选项对象
    extract: true, // 允许生成 CSS source maps?
    sourceMap: false, // pass custom options to pre-processor loaders. e.g. to pass options to // sass-loader, use { sass: { ... } }
    loaderOptions: {}, // Enable CSS modules for all css / pre-processor files. // This option does not affect *.vue files.
    modules: false,
  }, // use thread-loader for babel & TS in production build // enabled by default if the machine has more than 1 cores

  parallel: require("os").cpus().length > 1, // PWA 插件相关配置 // see https://github.com/vuejs/vue-cli/tree/dev/packages/%40vue/cli-plugin-pwa

  chainWebpack: (config) => {
    //设置标题  默认不设置的话是项目名字
    config.plugin("html").tap((args) => {
      args[0].title = "山东大学软件学院毕业去向信息网站";
      return args;
    });
  },

  pwa: {
    iconPaths: {
      favicon32: "sddxxh.ico",
      favicon16: "sddxxh.ico",
      appleTouchIcon: "sddxxh.ico",
      maskIcon: "sddxxh.ico",
      msTileImage: "sddxxh.ico",
    },
  },
  lintOnSave: false,
  devServer: {
    open: process.platform === "darwin",
    disableHostCheck: false,
    // host: "0.0.0.0",
    port: 5000,
    https: false,
    hotOnly: false,
    proxy: {
      "/api": {
        //   target: 'http://rap2api.taobao.org/app/mock/280048',
        target: "http://139.129.221.100:8382/",
        changeOrigin: true,
        pathRewrite: {
          "^/api": "/",
        },
      },
    },
  },
};
